package com.hengshan.common;

import com.hengshan.common.enums.ReturnCode;
import org.springframework.boot.web.servlet.error.ErrorController;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * 404异常捕获，springboot全局异常处理默认无法捕获404异常
 */
@RestController
public class NotFoundExceptionController implements ErrorController {

    @RequestMapping(value = {"/error"})
    public ResultBody error(HttpServletRequest request) {
        return ResultBody.fail(ReturnCode.REQUEST_NOT_FOUND);
    }

}
